package svc

import (
	"api/internal/config"
	"api/internal/middleware"
	"github.com/zeromicro/go-zero/rest"
	"github.com/zeromicro/go-zero/zrpc"
	"shop_srv/shopclient"
)

type ServiceContext struct {
	Config   config.Config
	AuthUser rest.Middleware
	ShopSrv  shopclient.Shop
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:   c,
		AuthUser: middleware.NewAuthUserMiddleware().Handle,
		ShopSrv:  shopclient.NewShop(zrpc.MustNewClient(c.ShopSrv)),
	}
}
